package deep.projects.newsapp.utils;

import android.content.Context;
import android.content.Intent;

import deep.projects.newsapp.activities.AboutActivity;
import deep.projects.newsapp.activities.CheckVersionActivity;
import deep.projects.newsapp.activities.FeedbackActivity;
import deep.projects.newsapp.activities.LoginActivity;
import deep.projects.newsapp.activities.NewsDetailActivity;
import deep.projects.newsapp.activities.ProfileActivity;
import deep.projects.newsapp.activities.RegisterActivity;
import deep.projects.newsapp.activities.RetrievePasswordActivity;
import deep.projects.newsapp.activities.SettingActivity;

/**
 * @author 吾心无待 于2016年03月05日
 */
public class ViewUtils {
    //region 页面跳转

    /**
     * 跳转到关于我们页面
     * @param ctx
     */
    public static void goAboutActivity(Context ctx){
        Intent i = new Intent(ctx,AboutActivity.class);
        ctx.startActivity(i);
    }

    /**
     * 跳转到个人信息页面
     * @param ctx
     */
    public static void goProfileActivity(Context ctx){
        Intent i = new Intent(ctx,ProfileActivity.class);
        ctx.startActivity(i);
    }

    /**
     * 跳转到个人登录页面
     * @param ctx
     */
    public static void goLoginActivity(Context ctx){
        Intent i = new Intent(ctx,LoginActivity.class);
        ctx.startActivity(i);
    }

    /**
     * 跳转到注册页面
     * @param ctx
     */
    public static void goRegisterActivity(Context ctx){
        Intent i = new Intent(ctx,RegisterActivity.class);
        ctx.startActivity(i);
    }

    /**
     * 跳转到设置页面
     * @param ctx
     */
    public static void goSettingActivity(Context ctx){
        Intent i = new Intent(ctx,SettingActivity.class);
        ctx.startActivity(i);
    }

    /**
     * 跳转到反馈页面
     * @param ctx
     */
    public static void goFeedbackActivity(Context ctx){
        Intent i = new Intent(ctx,FeedbackActivity.class);
        ctx.startActivity(i);
    }

    /**
     * 跳转到取回密码页面
     * @param ctx
     */
    public static void goRetrievePasswordActivity(Context ctx){
        Intent i = new Intent(ctx,RetrievePasswordActivity.class);
        ctx.startActivity(i);
    }

    /**
     * 显示新闻详情
     * @param ctx
     * @param newsId 新闻 ID
     * @param newsTypeId 新闻类型 ID
     *
     */
    public static void goNewsDetailActivity(Context ctx,int newsId,int newsTypeId,String url) {
        Intent intent = new Intent(ctx, NewsDetailActivity.class);
        intent.putExtra("NewsId", newsId);
        intent.putExtra("NewsTypeId", newsTypeId);
        intent.putExtra("Url", url);
        ctx.startActivity(intent);
    }

    public static void goCheckVersionActivity(Context ctx){
        Intent intent = new Intent(ctx, CheckVersionActivity.class);
        ctx.startActivity(intent);
    }
    //endregion
}
